<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Passport Checking...</title>
<style type="text/css">
<!--
#RtnLogin{
	position:absolute;
	font-size:24px;
	font-family:Comic Sans MS, cursive;
	font-weight:900;
	height:100%;
	top:50%; 
	margin-top:-24px;
	text-align:center;
	width:100%;
    color:#7e7e7e;
}
-->
</style>

<script type="text/javascript" src="./js/Common.js"></script>
<script type="text/javascript" language="javascript">
// <![CDATA[
tmrMove=0;
mTop= -18;

function Window_Load(){
	window.setTimeout(window.parent.fadeOut,1500);
	window.parent.fadeIn();
	window.parent.GetTopNow();
	if(!IsIELEQ7()) MoveThatDiv();
	window.setTimeout(KillMove,3000);
	Opacity("RtnLogin",80);
}

function KillMove(){
	window.clearTimeout(tmrMove);
}

function MoveThatDiv(){
	tmrMove=window.setTimeout(MoveThatDiv,10);
	mTop-=1;
	document.getElementById("RtnLogin").style.marginTop=mTop+"px";
}
// ]]>
</script>
</head>

<body bgcolor="transparent" style="background:none; height:100%" onload="javascript:Window_Load();">
    <div id="RtnLogin">
<%
	Username=request.Form("UserName")
	pswHash=request.Form("pswHash")
	if Username="" then
	%>
          <p align="center">
            Username Cannot be NULL!
          </p>
	<%
	else
		Nickname=request.Form("Nickname")
		Avatar=request.Form("Avatar")
		if Nickname="" then Nickname=Username
		if Avatar="" then Avatar="[Default]"
		on error resume next
			Dim conn,cmd
			Set conn = Server.CreateObject("ADODB.Connection")
			Set cmd = Server.CreateObject("ADODB.Command")
			conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("..\Data\#Message Board.mdb")
			With cmd
				.ActiveConnection = conn
				.CommandType = &H0004 '存储过程
				.CommandText = "AddUser"
			End With
			'走~
			Dim resultRS
			Set resultRS=cmd.Execute(, Array(Username,pswHash,Nickname,Avatar))
			
			if err.number>0 then
			%>
			  <p align="center">
				~Some Error Occurred Here~!
			  </p>
			<%
			else
				session("Login")=Username
				session("NickName")=Nickname
				session("Avatar")=Avatar
			%>
			  <p align="center">
				Register OK, Welcome <%=Nickname%>
			  </p>
			<%
			end if
			Set resultRS = Nothing
			Set cmd = Nothing
			conn.Close
			Set conn = Nothing
		end if
%>
    </div>
</body>
</html>